package main

import (
	"fmt"
	"strings"
)

func main() {
	example_string := "pwwkew"
	fmt.Println(lengthOfLongestSubstring(example_string))
}
func lengthOfLongestSubstring(s string) int {
	var max_len int
	j := 1
	n := len(s)
	for i:=0;i<n;i++{
		for j<n{
			if strings.Contains(s[i:j], string(s[j])){
				max_len = max(max_len, j-i)
				break
			}
			j++
		}
		if j==n{
			max_len = max(max_len, j-i)
		}
	}
	return max_len
}
func max(i int, j int) int {
	if i>j{
		return i
	}
	return j
}